package com.epam.necklace.view.menu.mainmenu;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.log4j.Logger;

import com.epam.necklace.logic.activity.FileActivity;
import com.epam.necklace.view.menu.MenuItem;

public class FileWrite extends MenuItem {
	private static final Logger log = Logger.getLogger(FileWrite.class);

	public FileWrite() {
		super("Write your necklace to file", "7");
	}

	@Override
	public boolean execute() {
		try {
			System.out.println("File write comand");
			FileActivity f = new FileActivity();
			f.serialize();
		} catch (FileNotFoundException e) {
			log.warn("File not found, try again " + e);
		} catch (IOException e) {
			log.warn("Input problems, try again " + e);
		}
		return true;
	}
}
